<notdefined name="W_UPLOADIER">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/Webuploader/webuploader.css" />
<script type="text/javascript" src="__PUBLIC__/Js/Webuploader/webuploader.js"></script>
<define name="W_UPLOADIER" value="1" />
</notdefined>

<div class="UploaderFileBox">
    <input id="{$name}_input" type="text" name="{$name}" value="{$value}" readonly /><div id="{$name}_pick" class="btn" >上传</div>
    <a id="{$name}_remove" class="btn" href="javascript:;">取消</a>
    <span id="{$name}_state" class="green"></span>
</div>

<script type="text/javascript">
(function($){
    var id="{$name}";
    var Wu = WebUploader.create({
        swf: "__PUBLIC__/Js/Webuploader/Uploader.swf",
        server:"{:U('Admin/Index/widget/name/uploader')}",
        pick: {
            id:'#'+id+'_pick',
            multiple:false,
        },
        auto:true,
        thumb:false,
        compress:false,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/*'
        },
        formData:{
            session_id : "{:session_id()}",
            //动态配置参数
            <foreach name="config" item="v" key="k">
            {$k}:"{$v}",
            </foreach>
        }
    });
    Wu.on( 'uploadSuccess', function( file ,response) {
        $('#'+id+'_input').val(response.url);
        $('#'+id+'_state').html('<a href="__ROOT__'+response.url+'" target="_blank" class="green">'+file.name+' 上传完成!</a>');
        Wu.reset();
    });
    $('#'+id+'_remove').click(function(e) {
        $('#'+id+'_input').val('');
        $('#'+id+'_state').html('');
    });
})(jQuery);
</script>